import * as React from 'react';
import { Form } from 'antd';
import validation from "../../utils/validation";
import ITable from "../../components/ITable"
import IAddress from "../../components/IAddress"
import ITxAddress from "../../components/ITxAddress"
const url: string = "/admin/wallet/deposits"
const rowKey: string = "id"
const filterData = {
    q: ""
}
const filter = [
    {
        type: "text",
        name: "q",
        label: "关键字",
        validation: validation.string,
    }
];

const ITButton: React.FC = () => {
    return (<>
    </>)
}
const columns = [
    {
        title: "流水号",
        dataIndex: "id",
    },
    {
        title: "时间",
        dataIndex: "createTime",
    },
    {
        title: "充值账号",
        dataIndex: "userDto",
        width:320,
        render: (value: any, record: any) => {
            return <>
                <p>账号：{value.email}</p>
                <p>手机号：{value.mobile}</p>
                <p>
                    钱包地址：
                    <IAddress username={value.username} />
                </p></>
        }
    },
    {
        title: "金额",
        dataIndex: "value",
    },
    {
        title: "单位",
        dataIndex: "unit",
    },
    {
        title: "交易Hash",
        dataIndex: "address",
        width:420,
        render: (value: any, record: any) => {
            return <ITxAddress tx={value}></ITxAddress>
        }
    },
    // {
    //     title: "操作",
    //     dataIndex: "pages",
    //     fixed: 'right',
    //     render: (value: any, record: any) => {
    //         let hashurl: string = "https://etherscan.io/tx/" + record.txId;
    //         let addressUrl: string = "https://etherscan.io/address/" + record.userDto.username

    //         return <>
    //             <p>
    //                 <a target="_blank" href={hashurl}>查看HASH地址</a>
    //             </p>
    //             <p>
    //                 <a target="_blank" href={addressUrl}>查看地址</a>
    //             </p>
    //         </>
    //     }
    // }
]


const Recharge: React.FC = (props) => {
    return (<div>
        <ITable
            {...props}
            columns={columns}
            filterData={filterData}
            filter={filter}
            url={url}
            rowKey={rowKey}
            ITButton={ITButton}
        />
    </div>)
}
export default Form.create({ name: 'Recharge' })(Recharge);